﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Prototypes
{
    /// <summary>
    /// Interaction logic for RegisterComplaintContent.xaml
    /// </summary>
    public partial class RegisterComplaintContent : UserControl
    {
        public RegisterComplaintContent()
        {
            InitializeComponent();
            cboxCompCountry.ItemsSource = GetCountryList();
        }

        private void SetFieldRestrictions()
        {
            //Date Restrictions
            CompBornDate.DisplayDateEnd = DateTime.Now;
            AggressorBornDate.DisplayDateEnd = DateTime.Now;
            VictimBornDate.DisplayDateEnd = DateTime.Now;

            //TextBox Restrictions
        }

        private List<string> GetCountryList()
        {
            List<string> cultureList = new List<string>();
            CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
            foreach (CultureInfo culture in cultures)
            {
                if (!culture.IsNeutralCulture && culture.LCID != 0x7F)
                {
                    RegionInfo region = new RegionInfo(culture.LCID);
                    if (!(cultureList.Contains(region.DisplayName)))
                        cultureList.Add(region.DisplayName);
                }
            }
            var sortedList = (from culture in cultureList
                              orderby culture
                              select culture).ToList();
            return sortedList;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var parent = ((ItemsControl)this.Parent);
            ((ItemsControl)this.Parent).Items.Clear();
            parent.Items.Add(new RegisterComplaintPart2());
        }

    }
}
